import axios from 'axios';

/**
 * 材料订单审核
 */
export class MaterialOrderAuditService {
  //分页查询订单列表
  static findMaterialOrders (queryParams) {
    return axios({
      url: '/restaurant/material/MaterialOrder/findMaterialOrders',
      method: 'POST',
      data: queryParams
    });
  }

  //更新订单状态
  static updateMaterialOrderAudit (materialOrderId,operate) {
    const query = {
      materialOrderId: materialOrderId,
      auditOperate: operate
    }
    return axios({
      url: '/restaurant/material/MaterialOrder/updateMaterialOrdeStatus',
      method: 'POST',
      params: query
    });
  }

  //根据ID查询指定的材料订单
  static findMaterialOrder (materialOrderId) {
    const query = {
      materialOrderId
    }
    return axios({
      url: '/restaurant/material/MaterialOrder/findMaterialOrder',
      method: 'POST',
      params: query,
    });
  }

  //根据ID查询指定的材料订单(包含外键名称)
  static findMaterialOrderForView (materialOrderId) {
    const query = {
      materialOrderId
    }
    return axios({
      url: '/restaurant/material/MaterialOrder/findMaterialOrderForView',
      method: 'POST',
      params: query,
    });
  }

  //根据ID查询指定的材料订单(包含外键名称)
  static findMaterialOrderForEdit (materialOrderId) {
    const query = {
      materialOrderId
    }
    return axios({
      url: '/restaurant/material/MaterialOrder/findMaterialOrderForEdit',
      method: 'POST',
      params: query,
    });
  }

  //根据ID查询指定的材料订单(只提取ID 和 Name)
  static findMaterialOrdersWithIdNameById (materialOrderId) {
    const query = {
      materialOrderId
    }
    return axios({
      url: '/restaurant/material/MaterialOrder/findMaterialOrdersWithIdNameById',
      method: 'POST',
      params: query,
    });
  }

  //根据名称查询材料订单集合(只提取ID 和 Name)
  static findMaterialOrdersWithIdNameByName (materialOrderName) {
    const query = {
      materialOrderName
    }
    return axios({
      url: '/restaurant/material/MaterialOrder/findMaterialOrdersWithIdNameByName',
      method: 'POST',
      params: query,
    });
  }

  //新增保存材料订单
  static saveMaterialOrder (materialOrder) {
    const query = {}
    return axios({
      url: '/restaurant/material/MaterialOrder/saveMaterialOrder',
      method: 'POST',
      params: query,
      data: materialOrder
    });
  }

  //修改保存材料订单
  static updateMaterialOrder (materialOrder) {
    const query = {}
    return axios({
      url: '/restaurant/material/MaterialOrder/updateMaterialOrder',
      method: 'POST',
      params: query,
      data: materialOrder
    });
  }

  //根据ID查询指定的材料订单(只提取ID 和 Name)
  static deleteMaterialOrder (materialOrderId) {
    const query = {
      materialOrderId
    }
    return axios({
      url: '/restaurant/material/MaterialOrder/deleteMaterialOrder',
      method: 'POST',
      params: query,
    });
  }
}
